﻿/*
* @autor: hectorea
* @date: 12/07/2012
* @programming interview 8
*/
using System;

namespace FibonacciNumber
{
    public static class IntExtension
    {
        /// <summary>
        /// Get the Fibbonacci Number
        /// </summary>
        /// <param name="number">Integer Value</param>
        /// <returns>The Fibonnacci Number</returns>
        public static int FibonacciNumber(this int number)
        {
            if (number <= 2) 
                return 1;

            return FibonacciNumber(number - 1) + FibonacciNumber(number - 2);
        }

        /// <summary>
        /// Get the Fibonacci Sequence of a number
        /// </summary>
        /// <param name="number">Integer Value</param>
        public static void FibonacciSequence(this int number)
        {
            for (int i = 1; i <= number; i++)
                Console.Write("{0} ", FibonacciNumber(i));
        }
    }
}